package com.example.source;

/**
 *
 *  * @projectName myflinkstu
 *  * @title     SourceTest2_File
 *  * @package    com.example.source
 *  * @description
 *  * @author hjx
 *  * @date   2022-3-17 16:55
 *  * @version V1.0.0
 *  * @copyright 2022 ty
 *
 */
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class SourceTest2_File {
    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        // 从文件读取数据
        DataStream<String> dataStream = env.readTextFile("E:\\hjx\\ideapro\\myflinkstu\\src\\main\\resources\\sensor.txt");

        // 打印输出
        dataStream.print();

        env.execute();
    }
}
